home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
TON_O_C.ARJ
/
SPLINE.DOC
< prev
next >
Wrap
Text File
|
1992-01-02
|
5KB
|
136 lines
To: info-ibmpc@usc-isib.ARPA
Subject: contribution to library
Date: Sat, 17 May 86 17:18:28 -0500
From: James R. Van Zandt <jrv@mitre-bedford.ARPA>
I'd like to submit this program to the library.
-------------------------------------------
SPLINE.C Generates splines under tension and allows general curves
and multiple independent curves in the same file. Text
input and output files like the UNIX program. Written in
C by J. R. Van Zandt, based on algorithms by A. K. Cline.
(jrv@mitre-bedford) May 17, 1986
------------------------------------------------------------
NAME
spline - interpolate using splines under tension
SYNOPSIS
spline [file] [options]
DESCRIPTION
Without options, SPLINE reads pairs of numbers (x- and y-values) from
the standard input (or the given file), generates a smooth curve
through the points, and writes to the standard output points from the
smooth curve. The curve is a spline under tension (see references),
which is somewhat "tighter" than a cubic spline, and less likely to
have spurious inflection points. As with GRAPH, each pair of points
may optionally be followed by a comment. If the comment is surrounded
by quotes "...", it may contain spaces. The given points, and
their comments if any, will be included in the output.
Input lines starting with ";" are written to the beginning of
the output file but are otherwise ignored. Blank lines are
ignored.
If the -c switch is not used, the input points must be from a function
- that is, the x values must be strictly increasing. The
output points will also be from a function. (If the -b switch
is used, this restriction applies only within each segment.)
If the -c switch is used (indicating a general curve), the
input points need not be from a function, but each pair of
points must be separated from the previous pair by a finite
distance. (If the -b switch is used, this restriction applies
only within each segment.)
options are:
-a [step [start]] Input data contains only y values - generate automatic
abscissas at intervals of step (default 1) starting at start
(default 0).
-b break the interpolation at each label. That is, the input
curve is divided into sections with the last point in
each section marked by a label (which may be empty:
""). A separate interpolating curve is to be found for
each section. In this case, the requirements on the
number of intervals (specified by the -n switch or
defaulted) and the interpolation range (specified by the
-x switch) are applied to each section independently.
-c general curve rather than function. In this case, the curve
is parameterized on the polygonal arclength from the
first to the last given point, with the whole length
scaled to be 1. Thus, the values min and max for the
-x switch should satisfy 0 <= min < max <= 1.
-n num interpolate over num intervals (default is 100)
-t num Specify tension in interpolating curve. Tension of 50 gives
almost polygonal line, tension of .01 gives almost cubic
spline. Default is 1.
-x [min [max]] interpolate from min to max only. min and max should be in
the range of the given x values, except that if the -c switch
is used they should satisfy 0 <= min < max <= 1.
-xl take log of x values before interpolating, take exponential
afterwards (probably necessary if -xl switch is needed for
GRAPH)
-yl take log of y values before interpolating, take exponential
afterwards (probably necessary if -yl switch is needed for
GRAPH)
NOTES
Similar to the Unix routine, except using splines under tension,
passing labels through, and allowing general curves.
REFERENCES
A. K. Cline, "Scalar- and Planar- Valued Curve Fitting Using
Splines Under Tension", Communications of the ACM v 17 n 4 p
218-223 (Apr 74).
Schweikert, D. G. "An interpolation curve using a spline in
tension", J. Math. and Physics v 45 p 312-317 (1966).
AUTHOR
Copyright (c) 1985 James R. Van Zandt
Resale forbidden, copying for personal use encouraged.
------------------------------------------------------------
/* spline - interpolate points in a tabulated function or curve
Usage...
spline [file][options]
options are:
-a [step [start]] automatic abscissas
-b break interpolation at each label
-c general curve
-n num interpolate over num intervals
-t num tension in interpolating curve
-x [min [max]] interpolate from min to max
Notes...
This program fits a smooth curve through a given set of points,
using the splines under tension introduced by Schweikert [J.
Math. and Physics v 45 pp 312-317 (1966)]. They are similar
to cubic splines, but are less likely to introduce spurious
inflection points.
History...
21 Sep 85 Added -xl and -yl switches for taking logs
23 Nov 85 Passing lines starting with ';' unchanged, otherwise
ignoring them.
Author...
Copyright (c) 1985 James R. Van Zandt
All rights reserved.
This program may be copied for personal, non-profit use only.
Based on algorithms by A. K. Cline [Communications of the ACM
v 17 n 4 pp 218-223 (Apr 74)].